eval(getCryptoJS());
var debug = true;

function aesDecrypt(result, base_lv, asc_key) {
    let tmpiv = CryptoJS.enc.Utf8.parse(base_lv);
    let key = CryptoJS.enc.Utf8.parse(asc_key);
    var b = CryptoJS.AES.decrypt(result, key, {
        iv: tmpiv,
        padding: CryptoJS.pad.Pkcs7
    });
    return CryptoJS.enc.Utf8.stringify(b);
}

function loadm3u8(jsurls) {
    var jsurl = "";
    for (i = 0; i < jsurls.length; i++) {
        var urls = jsurls[i].match(/https?:\/\/.*?\//);
        var domain = urls[0].substring(0, urls[0].length - 1);
        try {
            if(debug) {setError(jsurls[i])};
            json1 = fetch(jsurls[i], {
                headers: {
                    "referer": domain
                },
                timeout:20000
            });
            if (json1.match(/\((.*)\)/)) {
                json1 = json1.match(/\((.*)\)/)[1];
            }
            //setError(json1);
            json1 = JSON.parse(json1);
            if (json1.code == 200 && json1.url.search("404.") < 0) {
                jsurl = json1.url.search("http") == 0 ? json1.url : "https://" + json1.url;
            }
        } catch (e) {
            if(debug) {setError(e.msg);}
            jsurl = "";
            continue;
        }
        if (jsurl.match(/(\.m3u8)$/) && checkM3u8(jsurl)) {
            break
        } else if (jsurl != 0 && jsurl != "null" && jsurl != null) {
            break;
        }
        jsurl = "";
    }
    return jsurl;
}

function postm3u8(purls) {
    var jsurl = "";
    for (i = 0; i < purls.length; i++) {
        var urls = purls[i].url.match(/https?:\/\/.*?\//);
        var domain = urls[0].substring(0, urls[0].length - 1);
        try {
            if(debug) {setError(purls[i])}
            json1 = fetch(purls[i].url, {
                headers: {
                    "referer": domain
                },
                timeout:20000,
                body: purls[i].body,
                method: "post"
            });
            if (purls[i].cryptojs) {
                //setError(json1);
                json1 = aesDecrypt(json1, purls[i].base_lv, purls[i].asc_key);
            }
            //setError(json1);
            json1 = JSON.parse(json1);
            if (json1.code == 200 && json1.url.search("404.") < 0) {
                jsurl = json1.url.search("url=http") > -1 ? unescape(json1.url.split("url=")[1]) : json1.url.search("http") == 0 ? json1.url : "https://" + json1.url;
            }
        } catch (e) {
            if(debug) {setError(e.msg)}
            jsurl = "";
            continue;
        } 
        if (jsurl.match(/(\.m3u8)$/) && checkM3u8(jsurl)) {
            break
        } else if (jsurl != 0 && jsurl != "null" && jsurl != null) {
            break;
        }
        jsurl = "";
    }
    //setError(jsurl);
    return jsurl;
}

function loadjs(jsurls) {
    var jsurl = "";
    for (i = 0; i < jsurls.length; i++) {
        //setError(jsurls[i]);
        var urls = jsurls[i].match(/https?:\/\/.*?\//);
        var domain = urls[0].substring(0, urls[0].length - 1);
        try {
            if(debug) {setError(urls[0]);}
            result = fetch(jsurls[i], {
                headers: {
                    "referer": domain
                },
                timeout: 20000
            });
            //setError(result);
            if (result.match(/data/)) {
                jsurl = result.match(/var data ="(.*?)"/)[1];
                if (jsurl.search("share") > -1) {
                    result = fetch(jsurl);
                    jsurl = parseDom(result, "source&&src");
                }
            } else if (result.match(/alizyw.*/)) {
                js = result.match(/alizyw.*/)[0];
                jsurl = unescape(js);
            } else if (result.match(/&url=.*';/)) {
                js = result.match(/&url=(.*)&next=';/)[1];
                jsurl = unescape(js);
            } else if (result.match(/url\d* =.*/)) {
                js = result.match(/url\d* =(.*)/)[1];
                eval("url=" + js.replace("window.atob", "base64Decode"));
                jsurl = url;
            } else if (result.match(/urls =.*/)) {
                js = result.match(/urls =(.*)/)[1];
                eval("url=" + js);
                jsurl = url.search("http") == 0 ? url : "https:" + url;
            } else if (result.match(/url:([\s\S]*?),/)) {
                js = result.match(/url:([\s\S]*?),/)[1];
                jsurl = eval(js);
            } else if (result.match(/"url": ".*"/)) {
                js = result.match(/"url": "(.*?)"/)[1];
                jsurl = js;
            }
        } catch (e) {
            if(debug) {setError(e.msg)}
            jsurl = "";
            continue;
        }
        if (jsurl.match(/(\.m3u8)$/) && checkM3u8(jsurl)) {
            break
        } else if (jsurl != 0 && jsurl != "null" && jsurl != null) {
            break;
        }
        jsurl = "";
    }
    return jsurl;
}

function jxqq(jsurl, index) {
    //setError(jsurl);
    jurl = escape(jsurl);
    js_url = ["https://chenluo2.chenluo.org/chenluocs1/?url=", "https://vip.susou.tv/player/?url=", "https://vod.fooyun.xyz/share/video.php?vid=", "https://api.leduotv.com/wp-api/ifr.php?vid=", "https://jx.sujx.top/dp/?url=", "https://www.ifreefans.com/player/?url=", "https://api.68yulecheng.com/dp/?url="];

    jsurls = ["https://jx.ab33.top/vip/api.php?url=", "https://api.qianqi.net/vip/bingdouapi.php?url=", "http://jx.lache.me/ccds/api.php?danmu=0&url=", "https://www.41478.net/api.php?tp=checkPlay&url=", "https://api.jx.yh0523.cn/api/pgjx-1/api.php?url=", "https://jx.52a.ink/api.php?dd=1&tp=link&url=", "https://jx.rdhk.net/api.php?dd=1&tp=link&url=", "http://vip.wandhi.com/api.php?url="];
    jsurl = loadjs(js_url.map(w => w + jurl));
    if (jsurl == "") {
        jsurl = loadm3u8(jsurls.map(w => w + jurl));
    }
    purls = [{
        url: "https://new.79da.com/api.php",
        body: "v=" + jurl
    }, {
        url: "https://www.xymav.com/p1/api_p1.php",
        body: "url=" + jurl
    }, {
        url: "https://jiexi8090.laobandq.com/jiexi20210115/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexi8090.laobandq.com/jiexi20210115/jx.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://h8jx.ccyjjd.com/h8jx07051/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://h8jx.ccyjjd.com/h8jx07051/jiexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jiexiapi.ntryjd.net/pangu/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexiapi.ntryjd.net/pangu/apijx.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://m3u8.zh188.net/20210508%60/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.playm3u8.cn/jiexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://1717yun.zh188.net/0526/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.1717yun.com/jx/ty.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://ckmov.ccyjjd.com/ckmov/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.ckmov.vip/api.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.ikandie.cn/jiexi/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jx.mw0.cc/8090/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jx.668game.cn/fuxing/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://vip.cjys.top/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jiexi8090.laobandq.com/jiexi2019/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexi8090.laobandq.com/jiexi20211/jx.php?url=" + jurl) + "&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.kpezp.cn/jx/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.kpezp.cn/jlexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "http://api.13tv.top/jiexi/api.php",
        body: "url=" + jurl + "&referer=&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.yemu.xyz/pangu/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.yemu.xyz/v/a.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jx.668game.cn/fuxing/api.php",
        body: "url=" + jurl + "&referer=&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }];

    //jsurl=0;
    if (jsurl == "") {
        jsurl = postm3u8(purls);
    }
    return jsurl;
}

function jxpptv(jsurl, index) {
    //setError(jsurl);
    jurl = escape(jsurl);
    js_url = ["https://chenluo2.chenluo.org/chenluocs1/?url=","https://vod.fooyun.xyz/share/video.php?vid=", "https://api.leduotv.com/wp-api/ifr.php?vid=", "https://jx.sujx.top/dp/?url=", "https://www.ifreefans.com/player/?url=", "https://api.68yulecheng.com/dp/?url="];

    jsurls = ["https://jx.ab33.top/vip/api.php?url=", "https://api.qianqi.net/vip/bingdouapi.php?url=", "http://jx.lache.me/ccds/api.php?danmu=0&url=", "https://www.41478.net/api.php?tp=checkPlay&url=", "http://vip.wandhi.com/api.php?url=", "https://api.jx.yh0523.cn/api/pgjx-1/api.php?url=", "https://jx.52a.ink/api.php?dd=1&tp=link&url=", "https://jx.rdhk.net/api.php?dd=1&tp=link&url="];
    jsurl = loadjs(js_url.map(w => w + jurl));
    if (jsurl == "") {
        jsurl = loadm3u8(jsurls.map(w => w + jurl));
    }
    purls = [{
        url: "https://new.79da.com/api.php",
        body: "v=" + jurl
    }, {
        url: "https://www.xymav.com/p1/api_p1.php",
        body: "url=" + jurl
    }, {
        url: "https://jiexi8090.laobandq.com/jiexi20210115/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexi8090.laobandq.com/jiexi20210115/jx.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://h8jx.ccyjjd.com/h8jx07051/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://h8jx.ccyjjd.com/h8jx07051/jiexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jiexiapi.ntryjd.net/pangu/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexiapi.ntryjd.net/pangu/apijx.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://m3u8.zh188.net/20210508%60/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.playm3u8.cn/jiexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://1717yun.zh188.net/0526/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.1717yun.com/jx/ty.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://ckmov.ccyjjd.com/ckmov/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.ckmov.vip/api.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.ikandie.cn/jiexi/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jx.mw0.cc/8090/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jx.668game.cn/fuxing/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://vip.cjys.top/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jiexi8090.laobandq.com/jiexi2019/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexi8090.laobandq.com/jiexi20211/jx.php?url=" + jurl) + "&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.kpezp.cn/jx/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.kpezp.cn/jlexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "http://api.13tv.top/jiexi/api.php",
        body: "url=" + jurl + "&referer=&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.yemu.xyz/pangu/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.yemu.xyz/v/a.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jx.668game.cn/fuxing/api.php",
        body: "url=" + jurl + "&referer=&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }];

    //jsurl=0;
    if (jsurl == "") {
        jsurl = postm3u8(purls);
    }
    return jsurl;
}

function jxyouku(jsurl, index) {
    //setError(jsurl);
    jurl = escape(jsurl);
    js_url = ["https://vip.susou.tv/player/?url=", "https://api.leduotv.com/wp-api/ifr.php?vid=", "https://jx.sujx.top/dp/?url=", "https://www.ifreefans.com/player/?url=", "https://jx.mmkv.cn/jiexi.php?url=", "https://api.68yulecheng.com/dp/?url="];

    jsurls = ["https://jx.ab33.top/vip/api.php?url=", "https://api.qianqi.net/vip/bingdouapi.php?url=", "http://jx.lache.me/ccds/api.php?danmu=0&url=", "http://vip.wandhi.com/api.php?url=", "https://api.jx.yh0523.cn/api/pgjx-1/api.php?url=", "https://jx.52a.ink/api.php?dd=1&tp=link&url=", "https://jx.rdhk.net/api.php?dd=1&tp=link&url=", "https://www.41478.net/api.php?tp=checkPlay&url="];
    purls = [{
        url: "https://www.xymav.com/p1/api_p1.php",
        body: "url=" + jurl
    }, {
        url: "https://jiexi8090.laobandq.com/jiexi20210115/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexi8090.laobandq.com/jiexi20210115/jx.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://h8jx.ccyjjd.com/h8jx07051/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://h8jx.ccyjjd.com/h8jx07051/jiexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jiexiapi.ntryjd.net/pangu/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexiapi.ntryjd.net/pangu/apijx.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://m3u8.zh188.net/20210508%60/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.playm3u8.cn/jiexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://1717yun.zh188.net/0526/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.1717yun.com/jx/ty.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://ckmov.ccyjjd.com/ckmov/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.ckmov.vip/api.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.ikandie.cn/jiexi/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jx.mw0.cc/8090/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jx.668game.cn/fuxing/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://vip.cjys.top/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://1717yun.zh188.net/0526/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.1717yun.com/jx/ty.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jiexi8090.laobandq.com/jiexi2019/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexi8090.laobandq.com/jiexi20211/jx.php?url=" + jurl) + "&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.kpezp.cn/jx/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.kpezp.cn/jlexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "http://api.13tv.top/jiexi/api.php",
        body: "url=" + jurl + "&referer=&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.yemu.xyz/pangu/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.yemu.xyz/v/a.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jx.668game.cn/fuxing/api.php",
        body: "url=" + jurl + "&referer=&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }];
    jsurl = loadjs(js_url.map(w => w + jurl));
    if (jsurl == "") {
        jsurl = loadm3u8(jsurls.map(w => w + jurl));
    }
    if (jsurl == "") {
        jsurl = postm3u8(purls);
    }
    return jsurl;
}

function jxmgtv(jsurl, index) {
    //setError(jsurl);
    js_url = ["https://vip.susou.tv/player/?url=", "https://jiexi.dplayer.club/jianghu.php?url=", "https://titan.mgtv.com.okjx.cc/analysis.php?url=", "https://api.leduotv.com/wp-api/ifr.php?vid=", "https://jx.sujx.top/dp/?url=", "https://www.ifreefans.com/player/?url=", "https://jx.mmkv.cn/jiexi.php?url=", "https://api.68yulecheng.com/dp/?url="];

    jsurls = ["https://jx.ab33.top/vip/api.php?url=", "https://api.qianqi.net/vip/bingdouapi.php?url=", "http://jx.lache.me/ccds/api.php?danmu=0&url=", "https://www.41478.net/api.php?tp=checkPlay&url=", "http://vip.wandhi.com/api.php?url=", "https://api.jx.yh0523.cn/api/pgjx-1/api.php?url=", "https://jx.52a.ink/api.php?dd=1&tp=link&url=", "https://jx.rdhk.net/api.php?dd=1&tp=link&url="];

    jurl = escape(jsurl);
    purls = [{
        url: "https://jx.618g.com/api.php",
        base_lv: CryptoJS.MD5("618G618G").toString().substring(0x0, 0x10),
        asc_key: CryptoJS.MD5("618G618G").toString().substring(0x10),
        cryptojs: true,
        body: "url=" + jurl
    }, {
        url: "https://660e.com/api.php",
        base_lv: CryptoJS.MD5("618G618G").toString().substring(0x0, 0x10),
        asc_key: CryptoJS.MD5("618G618G").toString().substring(0x10),
        cryptojs: true,
        body: "url=" + jurl
    }, {
        url: "https://playmgtvcache.ccyjjd.com/mgtv20210115%60/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://playmgtvcache.ccyjjd.com/play.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.xymav.com/p1/api_p1.php",
        body: "url=" + jurl
    }, {
        url: "https://jiexi8090.laobandq.com/jiexi20210115/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexi8090.laobandq.com/jiexi20210115/jx.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://h8jx.ccyjjd.com/h8jx07051/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://h8jx.ccyjjd.com/h8jx07051/jiexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jiexiapi.ntryjd.net/pangu/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexiapi.ntryjd.net/pangu/apijx.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://m3u8.zh188.net/20210508%60/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.playm3u8.cn/jiexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://1717yun.zh188.net/0526/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.1717yun.com/jx/ty.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://ckmov.ccyjjd.com/ckmov/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.ckmov.vip/api.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.ikandie.cn/jiexi/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jx.mw0.cc/8090/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jx.668game.cn/fuxing/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://vip.cjys.top/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://1717yun.zh188.net/0526/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.1717yun.com/jx/ty.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jiexi8090.laobandq.com/jiexi2019/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexi8090.laobandq.com/jiexi20211/jx.php?url=" + jurl) + "&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.kpezp.cn/jx/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.kpezp.cn/jlexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "http://api.13tv.top/jiexi/api.php",
        body: "url=" + jurl + "&referer=&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.yemu.xyz/pangu/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.yemu.xyz/v/a.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jx.668game.cn/fuxing/api.php",
        body: "url=" + jurl + "&referer=&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }];

    jsurl = loadjs(js_url.map(w => w + jurl));
    if (jsurl == "") {
        jsurl = postm3u8(purls);
    }
    if (jsurl == "") {
        jsurl = loadm3u8(jsurls.map(w => w + jurl));
    }
    return jsurl;
}

function jxiqiyi(jsurl, index) {
    //setError(jsurl);
    jurl = escape(jsurl);
    js_url = ["https://api.68yulecheng.com/dp/?url=", "https://www.ifreefans.com/player/?url=", "https://jx.mmkv.cn/jiexi.php?url=", "https://jx.sujx.top/dp/?url=", "https://api.leduotv.com/wp-api/ifr.php?vid=", "https://vip.susou.tv/player/?url="];

    jsurls = ["https://jx.ab33.top/vip/api.php?url=", "https://api.qianqi.net/vip/bingdouapi.php?url=", "http://jx.lache.me/ccds/api.php?danmu=0&url=", "http://vip.wandhi.com/api.php?url=", "https://api.jx.yh0523.cn/api/pgjx-1/api.php?url=", "https://jx.52a.ink/api.php?dd=1&tp=link&url=", "https://jx.rdhk.net/api.php?dd=1&tp=link&url="];
    purls = [{
        url: "https://playmgtvcache.ccyjjd.com/mgtv20210115%60/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://playmgtvcache.ccyjjd.com/play.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.xymav.com/p1/api_p1.php",
        body: "url=" + jurl
    }, {
        url: "https://jiexi8090.laobandq.com/jiexi20210115/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexi8090.laobandq.com/jiexi20210115/jx.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://h8jx.ccyjjd.com/h8jx07051/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://h8jx.ccyjjd.com/h8jx07051/jiexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jiexiapi.ntryjd.net/pangu/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexiapi.ntryjd.net/pangu/apijx.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://m3u8.zh188.net/20210508%60/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.playm3u8.cn/jiexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://1717yun.zh188.net/0526/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.1717yun.com/jx/ty.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://ckmov.ccyjjd.com/ckmov/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.ckmov.vip/api.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.ikandie.cn/jiexi/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jx.mw0.cc/8090/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://jx.668game.cn/fuxing/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://vip.cjys.top/api.php",
        body: "url=" + jurl + "&referer=&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios=1"
    }, {
        url: "https://1717yun.zh188.net/0526/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.1717yun.com/jx/ty.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jiexi8090.laobandq.com/jiexi2019/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://jiexi8090.laobandq.com/jiexi20211/jx.php?url=" + jurl) + "&ref=1&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.kpezp.cn/jx/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.kpezp.cn/jlexi.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "http://api.13tv.top/jiexi/api.php",
        body: "url=" + jurl + "&referer=&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://www.yemu.xyz/pangu/api.php",
        body: "url=" + jurl + "&referer=" + base64Encode("https://www.yemu.xyz/v/a.php?url=" + jurl) + "&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    }, {
        url: "https://jx.668game.cn/fuxing/api.php",
        body: "url=" + jurl + "&referer=&ref=0&time=1626343068&type=&other=" + base64Encode(jurl) + "&ios="
    },{
        url: "https://jx.618g.com/api.php",
        base_lv: CryptoJS.MD5("618G618G").toString().substring(0x0, 0x10),
        asc_key: CryptoJS.MD5("618G618G").toString().substring(0x10),
        cryptojs: true,
        body: "url=" + jurl
    }, {
        url: "https://660e.com/api.php",
        base_lv: CryptoJS.MD5("618G618G").toString().substring(0x0, 0x10),
        asc_key: CryptoJS.MD5("618G618G").toString().substring(0x10),
        cryptojs: true,
        body: "url=" + jurl
    }];
    jsurl = postm3u8(purls);
    if (jsurl == "") {
        jsurl = loadjs(js_url.map(w => w + jurl));
    }
    if (jsurl == "") {
        jsurl = loadm3u8(jsurls.map(w => w + jurl));
    }
    return jsurl;
}

function getVid() {
    vurl = ["http://api2.xmsszt.com/content.php?vid=DOO0OOClWCGS9IPr5cAb9A8O000OucrPqpt6PBU5dFEtslnSt7Y0O0O0&type=qietv2s", "http://api.xosxx.com/content.php?vid=6Dg7AFih0NEZFEcN1hh4p7NqcS8cRVJ0DE2ngtjzpVU0O0O0&type=hls"]
}

function getM3u8Url1(jsurl, num) {
    jsurl = decode (jsurl);
    if (jsurl.search("share") > -1) {
        jssp = jsurl.split("\/share")[0];
        js =  fetch(jsurl,{timeout:30000});
        if(js=="") {
        putVar('fftq', jsurl);
        //putVar('bfq','0');
        refreshPage();
        'toast://切换share选集成功！'
        return;
        }
        if(js.match(/main = ".*?"/)) {
          jsurl = jssp + js.match(/main = "(.*?)"/)[1];
        } else if(js.match(/url:".*?"/)){
          jsurl = jssp + js.match(/url:"(.*?)"/)[1];
        }else if(js.match(/url:.*'.*?'/)){
          jsurl = jssp + js.match(/url:.*'(.*?)'/)[1];
        }
    } else if (jsurl.match(/^FQ:/)) {
        jsurl = "https://jx.fqzy.cc/jx.php?url=" + jsurl;
        putVar('fftq', jsurl);
        //putVar('bfq','0');
        refreshPage();
        'toast://切换FQ选集成功！'
        return;
    } else if (jsurl.match(/^XMM/)) {
        jsurl = "https://api.xxctzy.com/wp-api/ifr.php?isDp=1&vid=" + jsurl;
        putVar('fftq', jsurl);
        //putVar('bfq','0');
        refreshPage();
        'toast://切换XMM选集成功！'
        return;
    } else if (jsurl.match(/RongXing/)) {
        jsurl = "https://vip.fj6080.xyz/player/?url=" + jsurl;
        setError(jsurl)
        putVar('fftq', jsurl);
        //putVar('bfq','0');
        refreshPage();
        'toast://切换RongXing选集成功！'
        return;
     } else if (jsurl.match(/A85/)) {
        jsurl = "https://jx.yunboys.cn/?url=" + jsurl;
        setError(jsurl)
        putVar('fftq', jsurl);
        //putVar('bfq','0');
        refreshPage();
        'toast://切换A85选集成功！'
        return;
    } else if (jsurl.match(/^QQ_/)) {
        jsurl = "https://www.xxys5.com/pplay/jiexi.php?url=" + jsurl;
        setError(jsurl)
        putVar('fftq', jsurl);
        //putVar('bfq','0');
        refreshPage();
        'toast://切换QQ_选集成功！'
        return;
    } 
    else if(jsurl.search(".mp4")>-1){
        return jsurl+ "#isVideo=true#";
    }else if(jsurl.search(".mkv")>-1){
        return jsurl+ "#isVideo=true#";
    } else if (jsurl.search("qq.com") > -1) {
        jsurl = jxqq(jsurl, parseInt(num[2]) - 1);
    } else if (jsurl.search("iqiyi.com") > -1) {
        jsurl = jxiqiyi(jsurl, parseInt(num[2]) - 1);
    } else if (jsurl.search("youku.com") > -1) {
        jsurl = jxyouku(jsurl, parseInt(num[2]) - 1);
    } else if (jsurl.search("mgtv.com") > -1) {
        jsurl = jxmgtv(jsurl, parseInt(num[2]) - 1);
    } else if (jsurl.search("pptv.com") > -1) {
        jsurl = jxpptv(jsurl, parseInt(num[2]) - 1);
    } else if (jsurl.search("bilibili.com")>-1) {
        jsurl = ""
    } else if (!jsurl.match(/(\.m3u8)$/)){
        jsurl = jxqq(jsurl, parseInt(num[2]) - 1);
    }
    if(debug) {setError("VIP解析："+jsurl);}
    if (jsurl.match(/(\.m3u8)$/)){
      if(!checkM3u8(jsurl)) {
        putVar('fftq', input);
        refreshPage();
        'toast://切换选集成功！'
        return;
      }
    }
    if (jsurl.match(/(\.m3u8)$/)) {
        if (jsurl.indexOf("?") > -1) {
            jsurl = jsurl + "&k=v&memoryPosition=full";
        } else {
            jsurl = jsurl + "?k=v&memoryPosition=full";
        }
    }
    if (getVar('bfq') == '0') {
        putVar('fftq', jsurl);
        refreshPage();
        'toast://解析成功,切换选集成功！'
        return;
    }
    if (jsurl == "" || ! jsurl.match(/^http/)) {
        putVar('fftq', input);
        refreshPage();
        'toast://解析失败,切换选集成功！'
        return;
    } else {
    return jsurl + "#isVideo=true#";
    }
}


function getM3u8Url(jsurl, num) {
setError(jsurl);
var urll=jsurl;
if(urll.match(/youku|mgtv|ixigua|qq.com|qiyi|migu|bilibili|sohu|pptv|letv|le|pptv|migu|m1905/)){eval("var config =" + fetch("hiker://files/cache/MyParseSet.json"));eval(fetch(config.cj)); return aytmParse(urll)}else
if (!/^http/.test(urll)) {
showLoading("已开启强力嗅探，请稍候")
let result=$(playUrl).x5Lazy(() => {
    var urls = _getUrls()
    for (var i in urls) {
         if (!urls[i].match(/url=/)&&urls[i].match(/mp4|m3u8|obj/)) {
            fy_bridge_app.log(urls[i])
            return urls[i]+'#isVideo=true#'
        }
     }
   });
return result
}else{
return  urll+'#isVideo=true#';}
}
function getM3u8Js(js, input) {
    var num = 0;
    if (js.search("iframe") > -1) {
        jsurl = js.match(/src="(.*?)"/)[1];
    } else if (js.search("LA.init") > -1) {
        jsurl = js.match(/id:"(.*?)"/)[1];
    } else {
        eval(js);
    }
    if (js.search("now") > -1) {
        jsurl = now;
    } else if (js.search("player_aaaa") > -1) {
        jsurl = player_aaaa.url;
    } else if (js.search("player_data") > -1) {
        jsurl = player_data.url;
    } else if (js.search("playConfig") > -1) {
        jsurl = playConfig.pv;
    } else if (js.search("zanpiancms_player") > -1) {
        jsurl = zanpiancms_player.url;
    } else if (js.search("cms_player") > -1) {
        jsurl = cms_player.url;
    } else if (js.search("player_x10d26") > -1) {
        jsurl = player_x10d26.url;
    } else if (js.search("mac_url") > -1) {
        if (js.search("mac_urlx10d26") > -1) {
            mac_url = mac_urlx10d26
        }
        //setError(mac_url);
        t = mac_link.replace(/{src}/g, "(\\d+)").replace(/{num}/g, "\\d+").replace(/\?/g, "\\?");
        re = new RegExp(t);
        num1 = re.exec(input)[1];
        t = mac_link.replace(/{num}/g, "(\\d+)").replace(/{src}/g, "\\d+").replace(/\?/g, "\\?");
        re = new RegExp(t);
        num2 = re.exec(input)[1];
        num = [input, num1, num2];
        mac_urls = mac_url.split("$$$").map(w => w.split("#").map(c => c.split("$")[1]));
        jsurl = mac_urls[parseInt(num[1]) - 1][parseInt(num[2]) - 1];
    } else if (js.search("ff_urls") > -1) {
        if(input.match(/(\d+)-(\d+).html/)) {
          num = input.match(/(\d+)-(\d+).html/);
        } else if(input.match(/(\d+)\/(\d+).html/)) {
          num = input.match(/(\d+)\/(\d+).html/);
        } else if(input.match(/\?\d+-(\d+)-(\d+)/)) {
          num = input.match(/\?\d+-(\d+)-(\d+)/);
        }
        jsurl = JSON.parse(ff_urls).Data[num[1]].playurls[parseInt(num[2]) - 1][1];
    } else if (js.search("VideoListJson") > -1) {
        if(input.match(/(\d+)-(\d+).html/)) {
          num = input.match(/(\d+)-(\d+).html/);
        } else if(input.match(/(\d+)\/(\d+).html/)) {
          num = input.match(/(\d+)\/(\d+).html/);
        }
        jsurl = VideoListJson[0][parseInt(num[1]) + 1][num[2]].split("$")[1];
    } else if (js.search("VideoInfoList") > -1) {
        VideoListJson = VideoInfoList.split("$$$").map(w => {
            if (w.search("$$") > -1) {
                return w.split("$$").map(c => {
                    if (c.search("#") > -1) {
                        return c.split("#")
                    }
                })
            }
        });
        if(input.match(/(\d+)-(\d+).html/)) {
          num = input.match(/(\d+)-(\d+).html/);
        } else if(input.match(/(\d+)\/(\d+).html/)) {
          num = input.match(/(\d+)\/(\d+).html/);
        }
        jsurl = VideoListJson[parseInt(num[1])][1][num[2]].split("$")[1];
    }
    if (debug) {
        setError("原始地址：" + jsurl)
    };
    jsurl = decode(jsurl);
    if (debug) {
        setError("解码地址：" + jsurl)
    };
    jsurl = getM3u8Url(jsurl, num);
    return jsurl;
}
function getM3u8TJs(input) {
  return getM3u8TJs(input,PC_UA);
}
function getM3u8TJs(input,ua) {
    if(input.match(/^magnet/)) {
    setError("磁力"+input)
       json = fetch("http://194.53.108.10:3000/api/magnet",{headers:{'content-type':'application/json'},body:input,method:'POST'});
       if(json=="ok") {
       refreshPage();
       'toast://添加磁力成功'
       }
       return json;
    }
    try {
        if (input.match(/zizhi.com|qq.com|alizy.com|iqiyi.com|mgtv.com|youku.com|bilibili.com|letv.com|le.com|sohu.com|wasu.com|mgtv.com|migu.com|pptv.com|m1095.com|vip.1905.com|xigua.com/)) {
            jsurl = getM3u8Url(input, 0);
        } else {
             html = fetch(input, {headers: {"User-Agent": ua}});
            js = parseDomForHtml(html, '.ikf-player+script||.player__video||.contBox||#bofang_box||.stui-player__video||.embed-responsive||.hy-player||.player .main||.player||.box||.fed-play-player||.stui-player||.myui-player__video||#playbox||.playerbox||.km-player||.detailPosterIntro||.box||.detailPosterIntro||.player-wrapper||.wupanzhi||.mplayer||.player-ff||.players||.fed-play-player||#player||.iplays||.wrap1&&script&&Html')
            if (js == "") {
                src = parseDom(html, '.ikf-player+script||.player__video||#bofang_box||.stui-player__video||.embed-responsive||.hy-player||.player||.box||.fed-play-player||.stui-player||.myui-player__video||#playbox||.playerbox||.km-player||.detailPosterIntro||.box||.detailPosterIntro||.player-wrapper||.wupanzhi||.mplayer||.player-ff||.players||.fed-play-player||#player||.iplays||.wrap1&&script&&src');
                js = fetch(src);
            }
            if (debug) {
                setError(js);
            };
            jsurl = getM3u8Js(js, input);
        }
    } catch (e) {
        putVar('fftq', input);
        refreshPage();
        'toast://解析失败 切换选集成功！'
        return;
    }
    return jsurl;
}

function checkM3u8(jsurl) {
try {
    js = JSON.parse(request(jsurl,{timeout:3000000,withStatusCode:true}));
    if (js.statusCode==200&&js.body.search("EXTM3U") > -1) {
        if (debug) {
            setError(jsurl + "源正常")
        };
        return true;
    }
    } catch(e) {return false;}
}

//自定义数据
var document = {
    write: function(d) {return d;}
};

var base64decode = base64Decode;

function decode (jsurl) {
    if(jsurl.search("jiexi.7080tu.com")>-1) {
       jsurl = fetch(jsurl.replace("w.php",""));
       jsurl = jsurl.match(/iframe.*?src="(.*?)"/)[1].replace("?vid","api.php?v")
    }
    if(jsurl.match(/QQ_/)) {
       jsurl = fetch("https://www.xxys5.com/pplay/jiexi.php?url="+jsurl)
       jsurl = jsurl.match(/"url":"(.*)"/)[1]
    }
    if (jsurl.match(/vid=/)) {
        jsurl = fetch(jsurl, {});
    }
    if(jsurl.match(/m3u8\/\?v=/)) {
       jsurl = fetch(jsurl);
    }
    if(jsurl.search(/hls.loadSource/)>-1) {
        jsurl = jsurl.match(/hls.loadSource\("(.*?)"\)/)[1];
    }
    if(jsurl.match(/url: ".*?"/)) {
       jsurl = jsurl.match(/url: "(.*?)"/)[1];
    }
    if (jsurl.match(/url=/)) {
        jsurl = jsurl.match(/url=(.*m3u8)/)[1];
    }
    if (jsurl.match(/vid=(.*)/)) {
        jsurl = jsurl.match(/vid="?(.*)"?/)[1];
    } 
    if (jsurl.match(/^JT/)) {
        jsurl = decodeURIComponent(base64Decode(jsurl));
    } else if (jsurl.match(/aHR.*/)) {
        jsurl = base64Decode(jsurl.match(/(aHR.*)/)[1]);
    } else if (jsurl.match(/^%/)) {
        jsurl = decodeURIComponent(jsurl);
    }
    return jsurl;
}